package ar.edu.uba.fi.jmit.receiver.mock;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

public class HttpServletResponseMock implements HttpServletResponse {
	
	private Logger logger = Logger.getLogger(HttpServletResponseMock.class);
	
	private PrintWriter printWriter;
	
	private File file;
	
	public HttpServletResponseMock() {
		super();
		try {
			file = File.createTempFile("printWriter", "");
			printWriter = new PrintWriter(file);
		} catch (Exception e) {
			throw new RuntimeException("Error creating printWriter of HttpServletResponseMock");
		} 
	}
	
	public BufferedReader getReader() {
		try {
			return new BufferedReader(new FileReader(file));
		} catch (FileNotFoundException e) {
			throw new RuntimeException("Could not create reader");
		}
	}

	public void addCookie(Cookie arg0) {
		logger.info("addCookie");
		
	}

	public void addDateHeader(String arg0, long arg1) {
		logger.info("addDateHeader");
		
	}

	public void addHeader(String arg0, String arg1) {
		logger.info("addHeader");
		
	}

	public void addIntHeader(String arg0, int arg1) {
		logger.info("addIntHeader");
		
	}

	public boolean containsHeader(String arg0) {
		logger.info("containsHeader");
		return false;
	}

	public String encodeRedirectURL(String arg0) {
		logger.info("encodeRedirectURL");
		return null;
	}

	public String encodeRedirectUrl(String arg0) {
		logger.info("encodeRedirectUrl");
		return null;
	}

	public String encodeURL(String arg0) {
		logger.info("encodeURL");
		return null;
	}

	public String encodeUrl(String arg0) {
		logger.info("encodeUrl");
		return null;
	}

	public void sendError(int arg0) throws IOException {
		logger.info("sendError");
		
	}

	public void sendError(int arg0, String arg1) throws IOException {
		logger.info("sendError");
		
	}

	public void sendRedirect(String arg0) throws IOException {
		logger.info("sendRedirect");
		
	}

	public void setDateHeader(String arg0, long arg1) {
		logger.info("setDateHeader");
		
	}

	public void setHeader(String arg0, String arg1) {
		logger.info("setHeader");
		
	}

	public void setIntHeader(String arg0, int arg1) {
		logger.info("setIntHeader");
		
	}

	public void setStatus(int arg0) {
		logger.info("setStatus");
		
	}

	public void setStatus(int arg0, String arg1) {
		logger.info("setStatus");
		
	}

	public void flushBuffer() throws IOException {
		logger.info("flushBuffer");
		
	}

	public int getBufferSize() {
		logger.info("getBufferSize");
		return 0;
	}

	public String getCharacterEncoding() {
		logger.info("getCharacterEncoding");
		return null;
	}

	public String getContentType() {
		logger.info("getContentType");
		return null;
	}

	public Locale getLocale() {
		logger.info("getLocale");
		return null;
	}

	public ServletOutputStream getOutputStream() throws IOException {
		logger.info("getOutputStream");
		return null;
	}

	public PrintWriter getWriter() throws IOException {
		logger.info("getWriter");
		return printWriter;
	}

	public boolean isCommitted() {
		logger.info("isCommitted");
		return false;
	}

	public void reset() {
		logger.info("reset");
		
	}

	public void resetBuffer() {
		logger.info("resetBuffer");
		
	}

	public void setBufferSize(int arg0) {
		logger.info("setBufferSize");
		
	}

	public void setCharacterEncoding(String arg0) {
		logger.info("setCharacterEncoding");
		
	}

	public void setContentLength(int arg0) {
		logger.info("setContentLength");
		
	}

	public void setContentType(String arg0) {
		logger.info("setContentType");
		
	}

	public void setLocale(Locale arg0) {
		logger.info("setLocale");
		
	}

	

}
